<?php

/**
 * sfGuardUser form.
 *
 * @package    form
 * @subpackage sf_guard_user
 * @version    SVN: $Id: sfGuardUserForm.class.php 13001 2008-11-14 10:45:32Z noel $
 */
class step2ProfileForm extends BasesfGuardUserForm
{
  protected
    $pkName = null;

  public function configure()
  {
    parent::configure();



    unset(
      $this['last_login'],
       $this['full_profile'], 
      $this['created_at'],
      $this['salt'],
      $this['gender'],
      $this['email'],
      $this['algorithm'],
      $this['partner_id'],
      $this['is_active'],
      $this['is_online'],
      $this['is_video'],
      $this['is_partner'],
      $this['new_message'],
      $this['new_fav'],
      $this['new_interest'],
      $this['new_gift'],
      $this['time'],
      $this['is_photo'],
      $this['is_super_admin'],
      $this['sf_guard_user_group_list'],
      $this['astrology_sign'],
      $this['zodiac'],
      $this['hair_type'],
      $this['best_time_of_watch'],
      $this['add_language'],
      $this['add_child'],
      $this['education'],
      $this['introduction_letter'],
      $this['about_hobby'],
      $this['icq'],
      $this['adres'],
      $this['skype'],
      $this['have_child_partner'],
      $this['account'],
      $this['is_partner'],
      $this['partner_id'],
      $this['is_top'],
      $this['is_vip'],
      $this['is_abon'],
      $this['nickname'],
      $this['username'],
      $this['password'],
      $this['country'],
      $this['account'],
      $this['is_online'],
      $this['sesid'],
      $this['time'],
      $this['sf_guard_user_permission_list']
    );

     $lang = array('ru','en');

     $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'first_name'        => new sfWidgetFormInput(array(),array('size'=>25)),
      'last_name'        => new sfWidgetFormInput(array(),array('size'=>25)),



     ));

		 	$this->widgetSchema['birthday'] = new sfWidgetFormI18nDate(array('culture' =>sfContext::getInstance()->getUser()->getCulture(),'years' => sfContext::getInstance()->getUser()->getYears()));

		 	$this->widgetSchema['height'] = new sfWidgetFormInput(array(),array('size'=>5));

		 	$this->widgetSchema['ves'] = new sfWidgetFormInput();

		 	$this->widgetSchema['city'] = new sfWidgetFormInput(array(),array('size'=>5));

		 	$this->widgetSchema['country'] = new sfWidgetFormI18nSelectCountry(array('culture' =>sfContext::getInstance()->getUser()->getCulture()));

		 	$this->widgetSchema['eye_color'] = new sfWidgetFormInput(array(),array('size'=>25));

		 	$this->widgetSchema['hair_color'] = new sfWidgetFormInput(array(),array('size'=>25));

		 	$this->widgetSchema['religion'] = new sfWidgetFormChoice(array('expanded'=>false,'choices' => myTools::getReligion()));

		 	$this->widgetSchema['language'] = new sfWidgetFormI18nSelectLanguage(array('culture' => sfContext::getInstance()->getUser()->getCulture(),'languages'=>$lang));

                        if($this->getObject()->getId()>0){
                        $this->widgetSchema['add_language'] = new myWidgetLanguage(array(),array('user_id'=>$this->getObject()->getId()));
                        }

                        $this->widgetSchema['drinking'] = new sfWidgetFormInputCheckbox();

		 	$this->widgetSchema['smoking'] = new sfWidgetFormInputCheckbox();

		 	$this->widgetSchema['profession'] = new sfWidgetFormInput(array(),array('size'=>55));

		 	$this->widgetSchema['is_marital'] = new sfWidgetFormChoice(array('expanded'=>false,'choices' => myTools::getIsmarital()));

		 	$this->widgetSchema['have_child'] = new sfWidgetFormInputCheckbox();

		 	$this->widgetSchema['wants_children'] = new sfWidgetFormInputCheckbox();

		 	$this->widgetSchema['about_me'] = new sfWidgetFormTextarea(array(),array('style'=>'width:300px'));

		 	$this->widgetSchema['about_partner'] = new sfWidgetFormTextarea(array(),array('style'=>'width:300px'));

		 	$this->widgetSchema['photo'] =   new sfWidgetFormInputFile();

                             	$this->validatorSchema ['photo'] = new sfValidatorFile ( array ('required' => false,
		'path' => sfConfig::get ( 'sf_web_dir' ) . '/uploads/users/avatar',
		'mime_types' => 'web_images', 'max_size' => 500000, // 360 kB
        'validated_file_class' => 'sfUserAvatarValidatedFile' ) );
                        

			$age_from=$this->getObject()->getPartnerAgeFrom();
			$age_to=$this->getObject()->getPartnerAgeTo();
			$height_from=$this->getObject()->getPartnerHeightFrom();
			$height_to=$this->getObject()->getPartnerHeightTo();

		   $this->widgetSchema['partner_age_from_to'] =
		   	new myRangeAgePartnerWidget(array('partner_age_from'=>new sfWidgetFormInput(array(),array('size'=>5)),
		   							       'partner_age_to'=>new sfWidgetFormInput(array(),array('size'=>5))),
		   								array('partner_age_from'=>$age_from,
		   								'partner_age_to'=>$age_to));
		   $this->widgetSchema['partner_height_from_to'] =

		   	new myRangeHeightPartnerWidget(array('partner_height_from'=>new sfWidgetFormInput(array(),array('size'=>5)),
		   								'partner_height_to'=>new sfWidgetFormInput(array(),array('size'=>5))),
		   								array('partner_height_from'=>$height_from,
		   								'partner_height_to'=>$height_to));
					 			 			

		 //////////////////Мультики

		     $this->setDefault('cmy_read',myTools::db_array_field($this->object->getMyRead()));
		     $this->setDefault('cmy_musik',myTools::db_array_field($this->object->getMyMusik()));
		     $this->setDefault('cmy_rest',myTools::db_array_field($this->object->getMyRest()));
		     $this->setDefault('cmy_food',myTools::db_array_field($this->object->getMyFood()));
		     $this->setDefault('cmy_sport',myTools::db_array_field($this->object->getMySport()));
		     $this->setDefault('cmy_harakter',myTools::db_array_field($this->object->getMyHarakter()));

	     $this->widgetSchema->setLabels(
    array(
      'username'  => __('Username'),
      'nickname'    => __('Username'),
      'avatar'   => __('Аватар'),
      'icq' => __('Номер ICQ'),
      'skype' => __('Номер skype'),
      'email'     => __('E-mail'),
      'password'  => __('Пароль'),
      'country' => __('Страна'),
      'gender' => __('Пол'),
      'birthday' => __('Дата рождения'),
      'password2' => __('Повтор пароля')
    )
    );


	     $this->validatorSchema->setOption('allow_extra_fields', true);
	     $this->widgetSchema->setNameFormat('user[%s]');


  }
}
